feat(cli): [experimental] flags + caret-versions sketch#520
Closed
feat(cli): [experimental] flags + caret-versions sketch#520
[experimental] flags + caret-versions sketch#520Conversation
Sketch only — both the [experimental] section and the compatible-resolution flag are explicitly unstable. Behavior may change or be removed. - Recognize [experimental] flags = [...] in mops.toml; older CLIs ignore it. - Hash flags into a separate optional experimentalHash in mops.lock so the fast-path stays untouched for projects that don't opt in, and toggling a flag invalidates the lockfile. - compatible-resolution: bare versions in the root project's [dependencies] / [dev-dependencies] resolve as Cargo-style caret ranges via the existing getHighestSemverBatch backend call. Aliased / github / local deps and transitives are unchanged. Made-with: Cursor
[experimental] flags + compatible-resolution sketch[experimental] flags + caret-versions sketch
- mops update / mops outdated honor the caret bound when the flag is on - prefetch upgraded versions before collectDeps reads transitive mops.toml - use semver.major() instead of manual parse - experimentalHash invalidates the lock fast path on flag toggle - 4 integration tests: install reproducibility, caret-bounded update, flag-toggle lock invalidation, no-flag major-cross control - drop incorrect "older CLIs fail loudly" claim from docs/changelog Also: replace deprecated @noble/hashes/sha256 with sha2. Made-with: Cursor
Collaborator
Author
|
Closing — the Pivoting to a smaller change in a new PR: make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
We want a way to ship and iterate on new CLI features without breaking changes. Today any new resolution / config behavior risks breaking other users' projects (and the earlier
feat/version-rangesattempt confirmed this — real range syntax is breaking for older CLIs and the registry canister rejects ranges in published manifests outright). Opt-in flags let us release new behavior continuously: users who want it turn it on; everyone else is unaffected.What this adds
[experimental]section inmops.toml— generic opt-in for unstable CLI behavior:caret-versionsflag — first flag, as a concrete shape for the mechanism. Bare versions in the root project's deps resolve as Cargo-style caret ranges:core = "1.2.3"→ highest published1.x.y(>=1.2.3, <2.0.0)core = "0.2.3"→ highest published0.2.x(>=0.2.3, <0.3.0)mops updateandmops outdatedhonor the same bound. Resolved version is pinned inmops.lock. Aliased deps (core@1 = "...") and transitive deps unaffected.mops.tomlsyntax does not change.Lockfile — adds optional
experimentalHashfield tomops.lockv3, so toggling flags invalidates the fast path. Absent for projects not opting in, so existing lockfiles see zero churn. Older CLIs that don't recognize the flag still read the lockfile and use the resolved versions transparently.Test plan
npm run check,npm run lintcleanisExperimentEnabledcli.test.tsagainst the live registry: install reproducibility, caret-boundedmops update, flag-toggle lock invalidation, no-flag major-cross controlcore = "1.0.0"+base = "0.14.5":corestays1.0.0,baseupgrades to0.14.14(capped at0.14.x); lockfile getsexperimentalHashmops outdatedsuggestscore 1.0.0 -> 2.5.0andbase 0.14.5 -> 0.16.0(both cross the caret bound)